<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 2017/7/12
 * Time: 15:22
 * Project name: PHPTEST
 * File name: 3.php
 * @copyright Copyright (c) 2016 ZRX Software LLC
 * @license https://github.com/zhangrxiang
 * @since 1.0.0
 */
$method = $_SERVER['REQUEST_METHOD'];

if ( $method === "POST" ) {
	$name = $_POST['name'];
	echo json_encode( [
		'status' => true,
		'type'   => $method,
		'name'   => $name
	] );

} elseif ( $method === "GET" ) {
	$name = $_GET['name'];
	echo json_encode( [
		'status' => true,
		'type'   => $method,
		'name'   => $name
	] );
} else {
	echo "fuck";
}

die();
